function queryBankForm(pageIndex,pageSize)
{
          var url =base+"/bankInfo/pageBankInfoList.do?pageIndex="+pageIndex+"&pageSize="+pageSize;
          var params =jQuery("#queryForm").serialize();
          params=decodeURIComponent(params,true); 
          jQuery("#bankContent").load(url+"&"+ encodeURI(encodeURI(params)));
}


function addBankInfo()
{
	    location.href=base+"/bankInfo/toRegBankInfo.do";
}

function toEditBankInfo(bankId)
{
     location.href=base+"/bankInfo/toEditBankInfo.do?bankId="+bankId;
}
 

function saveBankInfo()
{   
       //var handlerurl=base+"/bankAccount/addBankAccount.do";
	   var bankName =jQuery("#bankName").val();
	   var bankHome=jQuery("#bankHome").val();
	   var bankSeq=jQuery("#bankSeq").val();
	   if(!bankName)
	   {
		   alert("银行名称不能为空。");
		   return jQuery("#bankName").select();
	   }
	   if(!bankHome)
	   {
		   alert("银行地址不能为空。");
		   return jQuery("#bankHome").select();
	   }
	   if(!bankSeq)
	   {
		   alert("银行序列不能为空。");
		   return jQuery("#bankSeq").select();
	   }
	   var map = new Map();
       jQuery(":input",jQuery("#bankTable")).not(':button,:submit,:file,:reset').each(function(index,obj)
        {
                map.put(jQuery(obj).attr("name"),jQuery(obj).val());
        }
        );
        var result =eval("("+map._toJson()+")");
        $.ajax({
        type: "POST",
        url: handlerurl,  
        data: result, 
        success: function(data){ 
            var data=eval("("+data+")");
                if(data.STATUS==0)
                {
                     alert("保存成功!");
                     location.href=base+"/bankInfo.do";
                       return ;
                }
                alert(data.MSG);  
         } 
        }
    );  
}


function uploadBankInfo()
{
	var softLog = jQuery("#bankLogo").val();
	var fileExt=new Array("jpg","gif","png");
	if(softLog)
	{
		     var ext = softLog.substr(softLog.indexOf(".")+1).toLowerCase();
             if(fileExt.indexOf(ext)!=-1)
             { 
             	  jQuery("#bankInfoForm").ajaxSubmit(
                  {
        	        success:function(data){ 
                    var data=eval("("+data+")");
                    if(data.error==0)
                     {
                	   var pic=base+"/upload/"+data.url;
                       jQuery("#bankLogoImg").attr("src",pic); 
                       jQuery("#bankLogoIn").val(data.url);
                       return ;
                    }
                    alert(data.message); 
                   }
                 }
	 	        );
             }
             else
             {
             	alert("选择上传的文件格式不正确。请上传jpg,gif,png类型的图片!");
             }
	}
}

 